﻿<%@ Page Language="C#" MasterPageFile="~/Administration/Administration.Master" AutoEventWireup="true" CodeBehind="Links.aspx.cs" Inherits="IEWebSite.Administration.Links" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <h1>Links</h1>
        <asp:Label ID="lblError" runat="server" ForeColor="#FF9900"></asp:Label>
        <table style="border-width:0; margin-left:50px;">
            <tr>
                <td>
                   Link:
                </td>
                <td>
                    <asp:TextBox ID="txtLink" runat="server" Width="450px"></asp:TextBox>
                </td>
            </tr>
                 <tr>
                <td>
                   Titlu:
                </td>
                <td>
                    <asp:TextBox ID="txtTitlu" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Descriere:
                </td>
                <td>
                    <asp:TextBox ID="txtDescriere" runat="server" Width="450px"></asp:TextBox>
                </td>
            </tr>
        
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="LinkBtnAdd" runat="server" Text="Adauga" OnClick="LinkBtnAdd_Click" BackColor="#990000" Font-Bold="True" 
                     ForeColor="White"/>
                </td>
            </tr>
        </table>
        <h1>
            Stergere/Editare Link</h1>
        <div style="margin-left: 50px;">
            <asp:GridView ID="LinkGvName" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" CellPadding="4" DataSourceID="sqlGetLink" ForeColor="#333333"
                GridLines="None" PageSize="5" DataKeyNames="IdLink">
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                    <asp:BoundField DataField="IdLink" HeaderText="ID" ReadOnly="True" 
                        SortExpression="IdLink" InsertVisible="False" Visible="True"/>
                    <asp:BoundField DataField="Title" HeaderText="Titlu" SortExpression="Title" />
                    <asp:BoundField DataField="Descriere" HeaderText="Descriere" SortExpression="Descriere" />
                    <asp:BoundField DataField="Link" HeaderText="Link" SortExpression="Link" />
                </Columns>
                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
            <asp:SqlDataSource ID="sqlGetLink" runat="server" ConnectionString="<%$ ConnectionStrings:SiteIEConnectionString %>"
                SelectCommand="SELECT IdLink,Title,Descriere, Link FROM LinkTB"
                DeleteCommand="DELETE FROM LinkTB WHERE (IdLink = @IdLink)" 
                InsertCommand="INSERT INTO [LinkTB] ([Title],Descriere,Link) VALUES (@Title,@Descriere,@Link)"
                UpdateCommand="UPDATE LinkTB SET Title=@Title,Descriere=@Descriere,Link=@Link WHERE (IdLink = @IdLink)">
                <DeleteParameters>
                    <asp:Parameter Name="IdLink" />
                </DeleteParameters>
                <UpdateParameters>
                     <asp:Parameter Name="Title" Type="String" />
                     <asp:Parameter Name="Descriere" Type="String" />
                     <asp:Parameter Name="Link" Type="String" />
                     <asp:Parameter Name="IdLink" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                     <asp:Parameter Name="Title" Type="String" />
                     <asp:Parameter Name="Descriere" Type="String" />
                     <asp:Parameter Name="Link" Type="String" />
                </InsertParameters>
            </asp:SqlDataSource>
      </div>
</asp:Content>
